package cn.jhc.servlet;

import java.io.IOException;

import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import cn.jhc.bean.ShopBean;
import cn.jhc.dao.ConnectionFactory;
import cn.jhc.dao.TitleDAO;
@WebServlet(name="show jita servlet", urlPatterns= {"/showjita.do"})
public class ShowJitaServlet extends HttpServlet {

	@Override
	protected void doGet(HttpServletRequest req, HttpServletResponse resp)
			throws ServletException, IOException {
		req.setCharacterEncoding("UTF-8");
		String isbn = req.getParameter("isbn");
		TitleDAO dao = new TitleDAO();
		dao.setCon(ConnectionFactory.getConnection());
		ShopBean t = dao.getTitle(isbn);
		req.setAttribute("title", t);
		RequestDispatcher dispatcher = req.getRequestDispatcher("/showjita.jsp");
		dispatcher.forward(req, resp);
	}
}
